#include "signalaccesstest.h"

#if SIGNAL_ACCESS_TEST_ENABLED
#include <qDebug>
#include <dbc4cpp/parser.h>
#include "ECanVci.H"
#include "signalaccessor.h"

static int successTestCount = 0;
static int failTestCount = 0;

static QString toHexData(const BYTE *arr, int len)
{
    QString ret;
    for (int i = 0; i < len; i++) {
        ret.append(QObject::tr("%1 ").arg(arr[i], 2, 16, QChar('0')));
    }
    return ret.trimmed();
}

static QString msgData(const CAN_OBJ &obj)
{
    return toHexData(obj.Data, obj.DataLen);
}

static void executeGetTest(const CAN_OBJ &obj, const Signal &signal, int expect)
{
    int actual = SignalAccessor::getSignalValue(&obj, &signal);
    if (expect != actual) {
        qDebug() << QObject::tr("[SignalName: %1, StartBit: %2, BitLen: %3, ByteOrder: %4, Msg Data: %5] Get Test"
                                " Failed: expect got %6, but got %7")
                    .arg(signal.getName()).arg(signal.getStartBit()).arg(signal.getBitLen())
                    .arg((signal.getByteOrder() == Signal::BYTE_ORDER_TYPE_MOTOROLA) ? "Motorola" : "Intel")
                    .arg(msgData(obj)).arg(expect).arg(actual);
        failTestCount++;
    } else {
        successTestCount++;
    }
}

static void executeSetTest(CAN_OBJ &obj, Signal &signal, int sigVal, BYTE expect[8])
{
    SignalAccessor::setSignalValue(&obj, &signal, sigVal);
    if (memcmp(obj.Data, expect, obj.DataLen)) {
        qDebug() << QObject::tr("[SignalName: %1, StartBit: %2, BitLen: %3, ByteOrder: %4, Msg Data: %5] Set Test"
                                " Failed: signal value %8, expect got %6, but got %7")
                    .arg(signal.getName()).arg(signal.getStartBit()).arg(signal.getBitLen())
                    .arg((signal.getByteOrder() == Signal::BYTE_ORDER_TYPE_MOTOROLA) ? "Motorola" : "Intel")
                    .arg(msgData(obj)).arg(toHexData(expect, obj.DataLen)).arg(msgData(obj))
                    .arg(QString("0x%1").arg(sigVal, 0, 16));
        failTestCount++;
    } else {
        successTestCount++;
    }
}

struct TestGetItem
{
    BYTE data[8];
    BYTE dataLen;
    QString signalName;
    int startBit;
    int bitLen;
    Signal::ByteOrderType byteOrder;
    int expect;
};

static void executeGetTest(const TestGetItem &item)
{
    CAN_OBJ obj;
    memcpy(obj.Data, item.data, 8);
    obj.DataLen = item.dataLen;

    Signal signal;
    signal.setName(item.signalName);
    signal.setBitLen(item.bitLen);
    signal.setStartBit(item.startBit);
    signal.setByteOrder(item.byteOrder);

    executeGetTest(obj, signal, item.expect);
}

struct TestSetItem
{
    BYTE data[8];
    BYTE dataLen;
    QString signalName;
    int startBit;
    int bitLen;
    Signal::ByteOrderType byteOrder;
    int sigVal;
    BYTE expect[8];
};

static void executeSetTest(TestSetItem &item)
{
    CAN_OBJ obj;
    memcpy(obj.Data, item.data, 8);
    obj.DataLen = item.dataLen;

    Signal signal;
    signal.setName(item.signalName);
    signal.setBitLen(item.bitLen);
    signal.setStartBit(item.startBit);
    signal.setByteOrder(item.byteOrder);

    executeSetTest(obj, signal, item.sigVal, item.expect);
}

static void executeGetTest(const TestGetItem *items, int itemCount)
{
    for (int i = 0; i < itemCount; i++) {
        executeGetTest(items[i]);
    }
}

static void executeSetTest(TestSetItem *items, int itemCount)
{
    for (int i = 0; i < itemCount; i++) {
        executeSetTest(items[i]);
    }
}

static void signalAccessTestGetMotorolaPostive()
{
    qDebug() << "Testing signalAccessTestMotorolaPostive()";

    TestGetItem items[] = {
        /********************没有跨行测试******************/
        // 首行(起始列)
        {{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        {{0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3},
        {{0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        {{0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3},
        {{0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        // 首行（中间列）
        {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 首行（末尾列）
        {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        // 中间行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CL_0"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 中间行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 中间行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        // 最后行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
         8, QString("SignalName_A_LL_CL_1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe},
         8, QString("SignalName_A_LL_CL_0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 最后行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
         8, QString("SignalName_A_LL_CM_1"), 60, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef},
         8, QString("SignalName_A_LL_CM_0"), 60, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 最后行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80},
         8, QString("SignalName_A_LL_CH_1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f},
         8, QString("SignalName_A_LL_CH_0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        /**********************跨行测试***********************/
        //跨一行(首行)
        {{0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_1"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff},
        {{0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_0"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 跨一行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00},
         8, QString("SignalName_B_M1_1"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff},
        {{0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff},
         8, QString("SignalName_B_M1_0"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        // 跨一行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8},
         8, QString("SignalName_B_L1_1"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07},
         8, QString("SignalName_B_L1_0"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},

        //跨两行（首行）
        {{0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_1"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff},
        {{0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_0"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        //跨两行（中间）
        {{0x00, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_1"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff},
        {{0xff, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_0"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
        //跨两行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8},
         8, QString("SignalName_B_L2_1"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07},
         8, QString("SignalName_B_L2_0"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0},
    };

    const int itemCount = sizeof(items) / sizeof(TestGetItem);
    executeGetTest(items, itemCount);

    qDebug() << "signalAccessTestMotorolaPostive() test done";
}

static void signalAccessTestSetMotorolaPostive()
{
    qDebug() << "Testing signalAccessTestSetMotorolaPostive()";

    TestSetItem items[] = {
        /********************没有跨行测试******************/
        // 首行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_I1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_I21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3,
         {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3,
         {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_I21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_21"), 1, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_I22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3,
         {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x3,
         {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_I22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_22"), 2, 2,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_I0"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0"), 0, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 首行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_I1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_I0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 首行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_I1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_I0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 中间行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_I1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CL_I0"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CL_0"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff}},

        // 中间行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_I1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_I0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff}},

        // 中间行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_I1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_I0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff}},

        // 最后行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_LL_CL_I1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
         8, QString("SignalName_A_LL_CL_1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_LL_CL_I0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe},
         8, QString("SignalName_A_LL_CL_0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}},

        // 最后行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
         8, QString("SignalName_A_LL_CM_1"), 60, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef},
         8, QString("SignalName_A_LL_CM_0"), 60, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef}},

        // 最后行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_LL_CH_I1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80},
         8, QString("SignalName_A_LL_CH_1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_LL_CH_I0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f},
         8, QString("SignalName_A_LL_CH_0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}},

        /**********************跨行测试***********************/
        //跨一行(首行)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_I1"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_1"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_I0"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_0"), 7, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 跨一行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M1_I1"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00},
         8, QString("SignalName_B_M1_1"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M1_I0"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff},
         8, QString("SignalName_B_M1_0"), 39, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x00, 0x07, 0xff, 0xff}},
        // 跨一行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_L1_I1"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8},
         8, QString("SignalName_B_L1_1"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_L1_I0"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07},
         8, QString("SignalName_B_L1_0"), 55, 13,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x07}},

        //跨两行（首行）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_I1"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_1"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_I0"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_0"), 7, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff}},

        //跨两行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_I1"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0x00, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00}},
        {{0x00, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_1"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0x00, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_I0"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff}},
        {{0xff, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_0"), 15, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff}},

        //跨两行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_L2_I1"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8},
         8, QString("SignalName_B_L2_1"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x1fffff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07},
         8, QString("SignalName_B_L2_I0"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07},
         8, QString("SignalName_B_L2_0"), 47, 21,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x07}},
    };
    const int itemCount = sizeof(items)/sizeof(TestSetItem);
    executeSetTest(items, itemCount);

    qDebug() << "signalAccessTestSetMotorolaPostive() test done";
}

static void signalAccessTestGetIntelPostive()
{
    qDebug() << "Testing signalAccessTestGetIntelPostive()";

    TestGetItem items[] = {
        /********************没有跨行测试******************/
        // 首行(起始列)
        {{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        {{0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3},
        {{0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        {{0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3},
        {{0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        // 首行（中间列）
        {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 首行（末尾列）
        {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        // 中间行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CL_0"), 32, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 中间行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 中间行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        // 最后行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
         8, QString("SignalName_A_LL_CL_1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe},
         8, QString("SignalName_A_LL_CL_0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 最后行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
         8, QString("SignalName_A_LL_CM_1"), 60, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef},
         8, QString("SignalName_A_LL_CM_0"), 60, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 最后行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80},
         8, QString("SignalName_A_LL_CH_1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f},
         8, QString("SignalName_A_LL_CH_0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        /**********************跨行测试***********************/
        //跨一行(首行)
        {{0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_1"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff},
        {{0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_0"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 跨一行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00},
         8, QString("SignalName_B_M1_1"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff},
        {{0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff},
         8, QString("SignalName_B_M1_0"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        // 跨一行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f},
         8, QString("SignalName_B_L1_1"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0},
         8, QString("SignalName_B_L1_0"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},

        //跨两行（首行）
        {{0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_1"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff},
        {{0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_0"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        //跨两行（中间）
        {{0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_1"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff},
        {{0xff, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_0"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
        //跨两行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f},
         8, QString("SignalName_B_L2_1"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe0},
         8, QString("SignalName_B_L2_0"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0},
    };
    const int itemCount = sizeof(items)/sizeof(TestGetItem);
    executeGetTest(items, itemCount);

    qDebug() << "signalAccessTestGetIntelPostive() test done";
}

static void signalAccessTestSetIntelPostive()
{
    qDebug() << "Testing signalAccessTestSetIntelPostive()";

    TestSetItem items[] = {
        /********************没有跨行测试******************/
        // 首行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_I1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_I21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3,
         {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3,
         {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_I21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_21"), 0, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_I22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3,
         {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CL_1_22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x3,
         {0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_I22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0_22"), 1, 2,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xf9, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_I0"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CL_0"), 0, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 首行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_I1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CM_1"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_I0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CM_0"), 4, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 首行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_I1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_FL_CH_1"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_I0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_FL_CH_0"), 7, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 中间行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_I1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CL_1"), 32, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("BYTE_ORDER_TYPE_INTEL"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff},
         8, QString("BYTE_ORDER_TYPE_INTEL"), 32, 1,
         Signal::BYTE_ORDER_TYPE_MOTOROLA, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff}},

        // 中间行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_I1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CM_1"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_I0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CM_0"), 36, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff}},

        // 中间行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_I1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_ML_CH_1"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_I0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_ML_CH_0"), 39, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff}},

        // 最后行(起始列)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_LL_CL_I1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
         8, QString("SignalName_A_LL_CL_1"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_LL_CL_I0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe},
         8, QString("SignalName_A_LL_CL_0"), 56, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe}},

        // 最后行（中间列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10},
         8, QString("SignalName_A_LL_CM_1"), 60, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef},
         8, QString("SignalName_A_LL_CM_0"), 60, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef}},

        // 最后行（末尾列）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_A_LL_CH_I1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80},
         8, QString("SignalName_A_LL_CH_1"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_A_LL_CH_I0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f},
         8, QString("SignalName_A_LL_CH_0"), 63, 1,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f}},

        /**********************跨行测试***********************/
        //跨一行(首行)
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_I1"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F1_1"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_I0"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F1_0"), 0, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}},

        // 跨一行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M1_I1"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00}},
        {{0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00},
         8, QString("SignalName_B_M1_1"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M1_I0"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff}},
        {{0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff},
         8, QString("SignalName_B_M1_0"), 32, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0x00, 0xe0, 0xff, 0xff}},
        // 跨一行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_L1_I1"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f},
         8, QString("SignalName_B_L1_1"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_L1_I0"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0},
         8, QString("SignalName_B_L1_0"), 48, 13,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0xe0}},

        //跨两行（首行）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_I1"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00}},
        {{0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_F2_1"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_I0"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff}},
        {{0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_F2_0"), 0, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff}},

        //跨两行（中间）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_I1"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00}},
        {{0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_M2_1"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0x00, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_I0"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff}},
        {{0xff, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_M2_0"), 8, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff}},

        //跨两行（末尾）
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
         8, QString("SignalName_B_L2_I1"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f}},
        {{0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f},
         8, QString("SignalName_B_L2_1"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x1fffff,
         {0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1f}},

        {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff},
         8, QString("SignalName_B_L2_I0"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe0}},
        {{0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe0},
         8, QString("SignalName_B_L2_0"), 40, 21,
         Signal::BYTE_ORDER_TYPE_INTEL, 0x0,
         {0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe0}},
    };
    const int itemCount = sizeof(items)/sizeof(TestSetItem);
    executeSetTest(items, itemCount);

    qDebug() << "signalAccessTestSetIntelPostive() test done";
}

int signalAccessorTest()
{
    qDebug() << qPrintable(QObject::tr("Start test signal accessor"));

    signalAccessTestGetMotorolaPostive();
    signalAccessTestSetMotorolaPostive();

    signalAccessTestGetIntelPostive();
    signalAccessTestSetIntelPostive();

    qDebug() << qPrintable(QObject::tr("Test signal accessor done."));
    qDebug() << qPrintable(QObject::tr("Total Test Count(%1). Success Test Count(%2). Fail Test Count(%3)")
                .arg(successTestCount+failTestCount).arg(successTestCount).arg(failTestCount));
    return (failTestCount > 0) ? 1 : 0;
}


#endif //SIGNAL_ACCESS_ENABLED

